<?php


namespace App\Repository1;


use App\Interfaces\BillerInterface;
use mysql_xdevapi\Exception;

class OrderProcessor
{

    /**
     * OrderProcessor constructor.
     */
    public function __construct(BillerInterface $biller, OrderRepository $order,array $validators = array())
    {
        $this->biller = $biller;
        $this->orders = $order;
        $this->validators = $validators;
    }

    public function process(Order $order)
    {

        foreach($this->validators as $validator)
        {
            $validator->validate($order);
        }
        $this->biller->bill($order->account->id, $order->amount);
        $this->order->logOrder($order);
    }

}